package com.lxw.manage_cms.service;


import com.lxw.framework.domain.system.SysDictionary;
import com.lxw.manage_cms.dao.SysDictionaryDao;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import java.util.Optional;

@Service
public class SysDictionaryServiceImpl implements ISysDictionaryService{

    @Autowired
    SysDictionaryDao sysDictionaryDao;

    @Override
    public SysDictionary getDictionary(String dType) {


        SysDictionary sysDictionary = new SysDictionary();
        sysDictionary.setDType(dType);
        Example<SysDictionary> of = Example.of(sysDictionary);
        Optional<SysDictionary> one = sysDictionaryDao.findOne(of);
        if (one.isPresent()){
            return one.get();
        }
        return null;
    }
}
